const storageManager = require('../storage');

/**
 * 工作流列表资源
 */
module.exports = {
  name: 'workflow-list',
  description: '当前项目的工作流列表',
  handler: async () => {
    try {
      const workflows = storageManager.getWorkflows();
      
      // 返回工作流的基本信息
      return workflows.map(workflow => ({
        id: workflow.id,
        name: workflow.name,
        description: workflow.description,
        stepCount: workflow.steps ? workflow.steps.length : 0,
        tags: workflow.tags,
        createdAt: workflow.createdAt,
        updatedAt: workflow.updatedAt
      }));
    } catch (error) {
      return {
        error: error.message
      };
    }
  }
}; 